//     vue
// --------------
// + $options
// + $el
// + $data
// ______________
// - _proxyData()
class Vue {
    constructor(options) {
        this.$options = options
        this.data = options.data
        this.$el = typeof options.el === 'string' ? document.querySelector(options.el) : options.el
        this._proxyData(this.data)
        new Observer(this.data)
        new Compiler(this.$el, this)
    }
    _proxyData(data) {
        Object.keys(data).forEach(key => {
            Object.defineProperty(this, key, {
                enumerable: true,
                configurable: true,
                get() {
                    return data[key]
                },
                set(newValue) {
                    if(data[key] === newValue) return 
                    this.data[key] = newValue
                }
            })
        })
    }
}